// 负责封装所有与组织架构相关的接口
import instance from '@/utils/request.js'

// 获取组织架构列表
export function getDepartmentApi () {
  return instance({
    url: '/company/department'
  })
}

// 删除组织架构
// id：当前点击部门的 id
export function delDepartmentApi (id) {
  return instance({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}

// 新增组织架构
export function addDepartmentApi (data) {
  return instance({
    url: '/company/department',
    method: 'POST',
    data
  })
}

// 根据 id 得到部门信息
export function getDepartmentByIdApi (id) {
  return instance({
    url: `/company/department/${id}`
  })
}

// 根据 id 修改部门信息
export function editDepartmentByIdApi (data) {
  return instance({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}
